Add llama-cpp-python backend for CosyVoice3#1872
Open
Ferraronp wants to merge 3 commits intoFunAudioLLM:mainfrom
Open
Add llama-cpp-python backend for CosyVoice3#1872Ferraronp wants to merge 3 commits intoFunAudioLLM:mainfrom
Ferraronp wants to merge 3 commits intoFunAudioLLM:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds optional llama-cpp-python inference backend for CosyVoice3, allowing CPU and low-VRAM inference using GGUF quantized models.
Changes
cosyvoice/cli/cosyvoice.py: Addedload_llama_cppandgguf_model_pathparameters toCosyVoice3.__init__. Overridesinference_zero_shot,inference_cross_lingual,inference_instruct2with llama.cpp path. Both streaming and non-streaming modes supported.cosyvoice/cli/model.py: Addedtts_with_external_tokensandtts_stream_external_llmmethods.README.md: Added llama-cpp-python backend installation and usage instructions.Usage
All existing inference methods (
inference_zero_shot,inference_cross_lingual,inference_instruct2) work unchanged.Performance (NVIDIA T4, fp16)
~2.6x faster inference on T4 GPU.
Pre-converted GGUF models
Available on Hugging Face: Ferraronp/CosyVoice3-qwen2.5-0.5b-speech-gguf
Converter: Ferraronp/CosyVoice-gguf-converter
Notes
CosyVoice3/Fun-CosyVoice3-0.5Bpip install llama-cpp-pythonload_llama_cpp=True, PyTorch LLM weights are not loaded to save VRAM